<?php

class IndexController extends BaseController{
    
    public function indexAction(){
        redirect(url('market/index'));
    }

    public function socketAction(){
        Yaf\loader::import(APP_PATH.'/common/lib/WebSocketClient.php');
        $data = array(
            'currency_id'=>1,
            'trade_currency_id'=>1,
            'member_id'=>1,
        );
        $Rsa = new Rsa();
        $signData = $data;
        $signData['code'] = md5(Yaf\Registry::get('config')->application->token);
        $client = new WebSocketClient(Yaf\Registry::get('serverConfig')->ws->ServerIp,Yaf\Registry::get('serverConfig')->ws->port);
        $clientConnect = $client->connect();
        ksort($signData);
        $sendData = array(
            'currency_id'=>1,
            'trade_currency_id'=>1,
            'member_id'=>1,
            'token'=>$Rsa->sign(json_encode($signData))
        );
        $client->send(json_encode($sendData));
        $result = $client->recv();
        print_r($result);
    }


}